package org.groupg.practice;

import org.jxls.builder.JxlsOutputFile;
import org.jxls.transform.poi.JxlsPoiTemplateFillerBuilder;

import java.io.File;
import java.io.FileNotFoundException;
import java.math.BigDecimal;
import java.util.*;

//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
    public static void main(String[] args) throws FileNotFoundException {
        //TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
        // to see how IntelliJ IDEA suggests fixing it.
        System.out.printf("Hello and welcome!");

        for (int i = 1; i <= 5; i++) {
            //TIP Press <shortcut actionId="Debug"/> to start debugging your code. We have set one <icon src="AllIcons.Debugger.Db_set_breakpoint"/> breakpoint
            // for you, but you can always add more by pressing <shortcut actionId="ToggleLineBreakpoint"/>.
            System.out.println("i = " + i);
        }

        List<Employee> employees = new ArrayList<>();

        employees.add(new Employee("001",new Date(), BigDecimal.valueOf(10)));
        employees.add(new Employee("002",new Date(), BigDecimal.valueOf(10)));
        employees.add(new Employee("003",new Date(), BigDecimal.valueOf(10)));


        Map<String, Object> data = new HashMap<>();
        data.put("employees", employees);
        JxlsPoiTemplateFillerBuilder.newInstance()
                .withTemplate("EachTest.xlsx")
                .build()
                .fill(data, new JxlsOutputFile(new File("target/report.xlsx")));
    }
}